# Contributor: Paul Onyschuk <blink@bojary.koba.pl>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=fossil
pkgver=2.18
pkgrel=0
pkgdesc="Simple, high-reliability, distributed software configuration management"
url="https://www.fossil-scm.org"
arch="all"
license="BSD-2-Clause"
options="!check" # bogus tests
checkdepends="coreutils ed tcllib"
makedepends="openssl1.1-compat-dev tcl-dev zlib-dev"
subpackages="$pkgname-bash-completion $pkgname-zsh-completion"
source="https://www.fossil-scm.org/home/tarball/version-$pkgver/fossil-$pkgver.tar.gz"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--json
	make TCC="${CC:-gcc} $CFLAGS"
}

package() {
	install -Dm 755 "$pkgname" "$pkgdir/usr/bin/$pkgname"

	# add shell completions
	install -Dm644 tools/fossil-autocomplete.bash \
		"$pkgdir"/usr/share/bash-completion/completions/fossil
	install -Dm644 tools/fossil-autocomplete.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_fossil
}

sha512sums="
fb5bf62721db3efc474fb63c52f1f7bc22508ac61c90a94906e50b8a3f591f020188d5605e8e540905be5565b8bfedafc1eda3c900e1db17669b12fb1c314ac3  fossil-2.18.tar.gz
"
